package com.example.musicplayer;

import android.app.Service;
;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.support.annotation.Nullable;

import java.io.IOException;

/**
 * Created by asd on 2016/8/28.
 */
public class MyServices extends Service {
    private MediaPlayer mediaPlayer;
    private String str;
    private String pwd;
    private long time;
    private Music music;

    @Override
    public void onCreate() {
        mediaPlayer = new MediaPlayer();
        super.onCreate();
    }

    private void play(String str) {
        mediaPlayer.reset();
        try {
            mediaPlayer.setDataSource(str);
            mediaPlayer.prepare();
            mediaPlayer.start();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {

//        Music music = (Music) intent.getSerializableExtra("music");
//        String pwd = intent.getStringExtra("pwd");
//        if ("play".equals(pwd)) {
////            play(music.getUrl());
//        }else{
//        }
        return super.onStartCommand(intent, flags, startId);
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {

        return null;
    }


}
